package club.kingyin.kyblog.core.utils.log;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;


/**
 * @author : kingyin
 * @version : 1.0
 * @program : Ky-Blog
 * @description : 统一日志处理
 * @create : 2021年08月13日 15:05
 **/

@Aspect
@Component
public class LogAspect extends AbstractLogAspect{

    // 切点
    @Pointcut("@annotation(club.kingyin.kyblog.core.utils.log.Log))")
    public void pt(){}

    @Pointcut("@annotation(club.kingyin.kyblog.core.utils.log.LogConsole)")
    public void ptConsole(){}

    @Around("ptConsole()")
    public Object logConsole(ProceedingJoinPoint joinPoint) throws InstantiationException, IllegalAccessException {
        return log(joinPoint, null);
    }

    @Around("pt()")
    public Object logDefault(ProceedingJoinPoint joinPoint) throws InstantiationException, IllegalAccessException {
        return log(joinPoint, null);
    }

}
